home *** CD-ROM | disk | FTP | other *** search
/ Internet Surfer 2.0 / Internet Surfer 2.0 (Wayzata Technology) (1996).iso / pc / text / mac / faqs.224 < prev    next >
Text File  |  1996-02-12  |  28KB  |  698 lines

  1. Frequently Asked Questions (FAQS);faqs.224
  2.  
  3.  
  4. Section 13. Lint
  5.  
  6. 13.1:    I just typed in this program, and it's acting strangely.  Can
  7.     you see anything wrong with it?
  8.  
  9. A:    Try running lint first (perhaps with the -a, -c, -h, -p and/or
  10.     other options).  Many C compilers are really only half-
  11.     compilers, electing not to diagnose numerous source code
  12.     difficulties which would not actively preclude code generation.
  13.  
  14. 13.2:    How can I shut off the "warning: possible pointer alignment
  15.     problem" message lint gives me for each call to malloc?
  16.  
  17. A:    The problem is that traditional versions of lint do not know,
  18.     and cannot be told, that malloc "returns a pointer to space
  19.     suitably aligned for storage of any type of object."  It is
  20.     possible to provide a pseudoimplementation of malloc, using a
  21.     #define inside of #ifdef lint, which effectively shuts this
  22.     warning off, but a simpleminded #definition will also suppress
  23.     meaningful messages about truly incorrect invocations.  It may
  24.     be easier simply to ignore the message, perhaps in an automated
  25.     way with grep -v.
  26.  
  27. 13.3:    Where can I get an ANSI-compatible lint?
  28.  
  29. A:    A product called FlexeLint is available (in "shrouded source
  30.     form," for compilation on 'most any system) from
  31.  
  32.         Gimpel Software
  33.         3207 Hogarth Lane
  34.         Collegeville, PA  19426  USA
  35.         (+1) 215 584 4261
  36.  
  37.     The System V release 4 lint is ANSI-compatible, and is available
  38.     separately (bundled with other C tools) from Unix Support Labs
  39.     (a subsidiary of AT&T), or from System V resellers.
  40.  
  41.  
  42. Section 14. Style
  43.  
  44. 14.1:    Here's a neat trick:
  45.  
  46.         if(!strcmp(s1, s2))
  47.  
  48.     Is this good style?
  49.  
  50. A:    Perhaps; perhaps not.  The test succeeds if the two strings are
  51.     equal, but its form suggests that it tests for inequality.
  52.  
  53.     Another solution is to use a macro:
  54.  
  55.         #define Streq(s1, s2) (strcmp((s1), (s2)) == 0)
  56.  
  57.     Opinions on code style, like those on religion, can be debated
  58.     endlessly.  Though good style is a worthy goal, and can usually
  59.     be recognized, it cannot be codified.
  60.  
  61. 14.2:    What's the best style for code layout in C?
  62.  
  63. A:    K&R, while providing the example most often copied, also supply
  64.     a good excuse for avoiding it:
  65.  
  66.         The position of braces is less important,
  67.         although people hold passionate beliefs.
  68.         We have chosen one of several popular styles.
  69.         Pick a style that suits you, then use it
  70.         consistently.
  71.  
  72.     It is more important that the layout chosen be consistent (with
  73.     itself, and with nearby or common code) than that it be
  74.     "perfect."  If your coding environment (i.e. local custom or
  75.     company policy) does not suggest a style, and you don't feel
  76.     like inventing your own, just copy K&R.  (The tradeoffs between
  77.     various indenting and brace placement options can be
  78.     exhaustively and minutely examined, but don't warrant repetition
  79.     here.  See also the Indian Hill Style Guide.)
  80.  
  81.     The elusive quality of "good style" involves much more than mere
  82.     code layout details; don't spend time on formatting to the
  83.     exclusion of more substantive code quality issues.
  84.  
  85.     Reference: K&R Sec. 1.2 p. 10.
  86.  
  87. 14.3:    Where can I get the "Indian Hill Style Guide" and other coding
  88.     standards?
  89.  
  90. A:    Various documents are available for anonymous ftp from:
  91.  
  92.         Site:            File or directory:
  93.  
  94.         cs.washington.edu    ~ftp/pub/cstyle.tar.Z
  95.         (128.95.1.4)        (the updated Indian Hill guide)
  96.  
  97.         cs.toronto.edu        doc/programming
  98.  
  99.         giza.cis.ohio-state.edu    pub/style-guide
  100.  
  101.  
  102. Section 15. Floating Point
  103.  
  104. 15.1:    My floating-point calculations are acting strangely and giving
  105.     me different answers on different machines.
  106.  
  107. A:    First, make sure that you have #included <math.h>, and correctly
  108.     declared other functions returning double.
  109.  
  110.     If the problem isn't that simple, recall that most digital
  111.     computers use floating-point formats which provide a close but
  112.     by no means exact simulation of real number arithmetic.
  113.     Underflow, cumulative precision loss, and other anomalies are
  114.     often troublesome.
  115.  
  116.     Don't assume that floating-point results will be exact, and
  117.     especially don't assume that floating-point values can be
  118.     compared for equality.  (Don't throw haphazard "fuzz factors"
  119.     in, either.)
  120.  
  121.     These problems are no worse for C than they are for any other
  122.     computer language.  Floating-point semantics are usually defined
  123.     as "however the processor does them;" otherwise a compiler for a
  124.     machine without the "right" model would have to do prohibitively
  125.     expensive emulations.
  126.  
  127.     This article cannot begin to list the pitfalls associated with,
  128.     and workarounds appropriate for, floating-point work.  A good
  129.     programming text should cover the basics.
  130.  
  131.     References: EoPS Sec. 6 pp. 115-8.
  132.  
  133. 15.2:    I'm trying to do some simple trig, and I am #including <math.h>,
  134.     but I keep getting "undefined: _sin" compilation errors.
  135.  
  136. A:    Make sure you're linking against the correct math library.  For
  137.     instance, under Unix, you usually need to use the -lm option at
  138.     the end of the command line when compiling/linking.
  139.  
  140. 15.3:    Why doesn't C have an exponentiation operator?
  141.  
  142. A:    You can #include <math.h> and use the pow() function, although
  143.     explicit multiplication is often better for small positive
  144.     integral exponents.
  145.  
  146.     References: ANSI Sec. 4.5.5.1 .
  147.  
  148. 15.4:    I'm having trouble with a Turbo C program which crashes and says
  149.     something like "floating point formats not linked."
  150.  
  151. A:    Some compilers for small machines, including Turbo C (and
  152.     Ritchie's original PDP-11 compiler), leave out floating point
  153.     support if it looks like it will not be needed.  In particular,
  154.     the non-floating-point versions of printf and scanf save space
  155.     by not including code to handle %e, %f, and %g.  It happens that
  156.     Turbo C's heuristics for determining whether the program uses
  157.     floating point are insufficient, and the programmer must
  158.     sometimes insert a dummy explicit floating-point call to force
  159.     loading of floating-point support.
  160.  
  161.  
  162. Section 16. System Dependencies
  163.  
  164. 16.1:    How can I read a single character from the keyboard without
  165.     waiting for a newline?
  166.  
  167. A:    Contrary to popular belief and many people's wishes, this is not
  168.     a C-related question.  (Nor are closely-related questions
  169.     concerning the echo of keyboard input.)  The delivery of
  170.     characters from a "keyboard" to a C program is a function of the
  171.     operating system in use, and has not been standardized by the C
  172.     language.  Some versions of curses have a cbreak() function
  173.     which does what you want.  Under UNIX, use ioctl to play with
  174.     the terminal driver modes (CBREAK or RAW under "classic"
  175.     versions; ICANON, c_cc[VMIN] and c_cc[VTIME] under System V or
  176.     Posix systems).  Under MS-DOS, use getch().  Under VMS, try the
  177.     Screen Management (SMG$) routines.  Under other operating
  178.     systems, you're on your own.  Beware that some operating systems
  179.     make this sort of thing impossible, because character collection
  180.     into input lines is done by peripheral processors not under
  181.     direct control of the CPU running your program.
  182.  
  183.     Operating system specific questions are not appropriate for
  184.     comp.lang.c .  Many common questions are answered in
  185.     frequently-asked questions postings in such groups as
  186.     comp.unix.questions and comp.os.msdos.programmer .  Note that
  187.     the answers are often not unique even across different variants
  188.     of a system; bear in mind when answering system-specific
  189.     questions that the answer that applies to your system may not
  190.     apply to everyone else's.
  191.  
  192.     References: PCS Sec. 10 pp. 128-9, Sec. 10.1 pp. 130-1.
  193.  
  194. 16.2:    How can I find out if there are characters available for reading
  195.     (and if so, how many)?  Alternatively, how can I do a read that
  196.     will not block if there are no characters available?
  197.  
  198. A:    These, too, are entirely operating-system-specific.  Some
  199.     versions of curses have a nodelay() function.  Depending on your
  200.     system, you may also be able to use "nonblocking I/O", or a
  201.     system call named "select", or the FIONREAD ioctl, or kbhit(),
  202.     or rdchk(), or the O_NDELAY option to open() or fcntl().
  203.  
  204. 16.3:    How can I clear the screen?  How can I print things in inverse
  205.     video?
  206.  
  207. A:    Such things depend on the terminal type (or display) you're
  208.     using.  You will have to use a library such as termcap or
  209.     curses, or some system-specific routines, to perform these
  210.     functions.
  211.  
  212. 16.4:    How do I read the mouse?
  213.  
  214. A:    Consult your system documentation, or ask on an appropriate
  215.     system-specific newsgroup (but check its FAQ list first).  Mouse
  216.     handling is completely different under the X window system than
  217.     it is under MS-DOS than it is on the Macintosh.
  218.  
  219. 16.5:    How can my program discover the complete pathname to the
  220.     executable file from which it was invoked?
  221.  
  222. A:    argv[0] may contain all or part of the pathname, or it may
  223.     contain nothing.  You may be able to duplicate the command
  224.     language interpreter's search path logic to locate the
  225.     executable if the name in argv[0] is present but incomplete.
  226.     However, there is no guaranteed or portable solution.
  227.  
  228. 16.6:    How can a process change an environment variable in its caller?
  229.  
  230. A:    In general, it cannot.  Different operating systems implement
  231.     name/value functionality similar to the Unix environment in
  232.     different ways.  Whether the "environment" can be usefully
  233.     altered by a running program, and if so, how, is system-
  234.     dependent.
  235.  
  236.     Under Unix, a process can modify its own environment (some
  237.     systems provide setenv() and/or putenv() functions to do this),
  238.     and the modified environment is usually passed on to any child
  239.     processes, but it is _not_ propagated back to the parent
  240.     process.
  241.  
  242. 16.7:    How can I find out the size of a file, prior to reading it in?
  243.  
  244. A:    If the "size of a file" is the number of characters you'll be
  245.     able to read from it in C, it is in general impossible to
  246.     determine this number in advance.  Under Unix, the stat()
  247.     function will give you an exact answer, and several other
  248.     systems supply a Unix-like stat() which will give an approximate
  249.     answer.  You can fseek to the end and then use ftell, but this
  250.     usage is nonportable (it gives you an accurate answer only under
  251.     Unix, and a guaranteed, but potentially approximate answer only
  252.     for ANSI C "binary" files).
  253.  
  254.     Are you sure you have to determine the file's size in advance?
  255.     Since the most accurate way of determining the size of a file as
  256.     a C program will see it is to open the file and read it, perhaps
  257.     you can rearrange the code to learn the size as it reads.
  258.  
  259. 16.8:    How can a file be shortened in-place without completely clearing
  260.     or rewriting it?
  261.  
  262. A:    BSD systems provide ftruncate(), several others supply chsize(),
  263.     and a few may provide a (possibly undocumented) fcntl option
  264.     F_FREESP.  Under MS-DOS, you can sometimes use
  265.     write(fd, "x", 0).  However, there is no truly portable
  266.     solution.
  267.  
  268. 16.9:    How can I implement a delay, or time a user's response, with
  269.     sub-second resolution?
  270.  
  271. A:    Unfortunately, there is no portable way.  V7 Unix, and derived
  272.     systems, provided a fairly useful ftime() routine with
  273.     resolution up to a millisecond, but it has disappeared from
  274.     System V and Posix.
  275.  
  276. 16.10:    How can I read in an object file and jump to routines in it?
  277.  
  278. A:    You want a dynamic linker and/or loader.  It is possible to
  279.     malloc some space and read in object files, but you have to know
  280.     an awful lot about object file formats, relocation, etc.  Under
  281.     BSD Unix, you could use system() and ld -A to do the linking for
  282.     you.  There is also a GNU package called "dld" which takes care
  283.     of some or all of this.  See also question 7.5.
  284.  
  285.  
  286. Section 17. Miscellaneous
  287.  
  288. 17.1:    What can I safely assume about the initial values of variables
  289.     which are not explicitly initialized?  If global variables start
  290.     out as "zero," is that good enough for null pointers and
  291.     floating-point zeroes?
  292.  
  293. A:    Variables with "static" duration (that is, those declared
  294.     outside of functions, and those declared with the storage class
  295.     static), are guaranteed initialized to zero, as if the
  296.     programmer had typed "= 0".  Therefore, such variables are
  297.     initialized to the null pointer (of the correct type) if they
  298.     are pointers, and to 0.0 if they are floating-point.
  299.  
  300.     Variables with "automatic" duration (i.e. local variables
  301.     without the static storage class) start out containing garbage,
  302.     unless they are explicitly initialized.  Nothing useful can be
  303.     predicted about the garbage.
  304.  
  305.     Dynamically-allocated memory obtained with malloc and realloc is
  306.     also likely to contain garbage, and must be initialized by the
  307.     calling program, as appropriate.  Memory obtained with calloc
  308.     contains all-bits-0, but this is not necessarily useful for
  309.     pointer or floating-point values (see question 3.9, and section
  310.     1).
  311.  
  312. 17.2:    How can I write data files which can be read on other machines
  313.     with different word size, byte order, or floating point formats?
  314.  
  315. A:    The best solution is to use text files (usually ASCII), written
  316.     with fprintf and read with fscanf or the like.  (Similar advice
  317.     also applies to network protocols.)  Be skeptical of arguments
  318.     which imply that text files are too big, or that reading and
  319.     writing them is too slow.  Not only is their efficiency
  320.     frequently acceptable in practice, but the advantages of being
  321.     able to manipulate them with standard tools can be overwhelming.
  322.  
  323.     If you must use a binary format, you can improve portability,
  324.     and perhaps take advantage of prewritten I/O libraries, by
  325.     making use of standardized formats such as Sun's XDR (RFC 1014),
  326.     OSI's ASN.1, CCITT's X.409, or ISO 8825 "Basic Encoding Rules."
  327.     See also question 9.10.
  328.  
  329. 17.3:    How can I return several values from a function?
  330.  
  331. A:    Either pass pointers to locations which the function can fill
  332.     in, or have the function return a structure containing the
  333.     desired values.  See also questions 2.12, 3.4, and 9.2.
  334.  
  335. 17.4:    If I have a char * variable pointing to the name of a function
  336.     as a string, how can I call that function?
  337.  
  338. A:    The most straightforward thing to do is maintain a
  339.     correspondence table of names and function pointers:
  340.  
  341.         int function1(), function2();
  342.  
  343.         struct {char *name; int (*funcptr)(); } symtab[] =
  344.             {
  345.             "function1",    function1,
  346.             "function2",    function2,
  347.             };
  348.  
  349.     Then, just search the table for the name, and call through the
  350.     associated function pointer.
  351.  
  352. 17.5:    I seem to be missing the system header file <sgtty.h>.  Can
  353.     someone send me a copy?
  354.  
  355. A:    Standard headers exist in part so that definitions appropriate
  356.     to your compiler, operating system, and processor can be
  357.     supplied.  You cannot just pick up a copy of someone else's
  358.     header file and expect it to work, unless that person is using
  359.     exactly the same environment.  Ask your compiler vendor why the
  360.     file was not provided (or to send a replacement copy).
  361.  
  362. 17.6:    How can I call FORTRAN (C++, BASIC, Pascal, Ada, LISP) functions
  363.     from C?  (And vice versa?)
  364.  
  365. A:    The answer is entirely dependent on the machine and the specific
  366.     calling sequences of the various compilers in use, and may not
  367.     be possible at all.  Read your compiler documentation very
  368.     carefully; sometimes there is a "mixed-language programming
  369.     guide," although the techniques for passing arguments and
  370.     ensuring correct run-time startup are often arcane.
  371.  
  372.     cfortran.h, a C header file, simplifies C/FORTRAN interfacing on
  373.     many popular machines.  It is available via anonymous ftp from
  374.     zebra.desy.de (131.169.2.244).
  375.  
  376.     In C++, a "C" modifier in an external function declaration
  377.     indicates that the function is to be called using C calling
  378.     conventions.
  379.  
  380. 17.7:    Does anyone know of a program for converting Pascal or FORTRAN
  381.     (or LISP, Ada, AWK, "Old" C, ...) to C?
  382.  
  383. A:    Several public-domain programs are available:
  384.  
  385.     p2c    written by Dave Gillespie, and posted to
  386.         comp.sources.unix in March, 1990 (Volume 21); also
  387.         available by anonymous ftp from csvax.cs.caltech.edu,
  388.         file pub/p2c-1.20.tar.Z .
  389.  
  390.     ptoc    another comp.sources.unix contribution, this one written
  391.         in Pascal (comp.sources.unix, Volume 10, also patches in
  392.         Volume 13?).
  393.  
  394.     f2c    jointly developed by people from Bell Labs, Bellcore,
  395.         and Carnegie Mellon.  To find about f2c, send the mail
  396.         message "send index from f2c" to netlib@research.att.com
  397.         or research!netlib.  (It is also available via anonymous
  398.         ftp on research.att.com, in directory dist/f2c.)
  399.  
  400.     This FAQ list's maintainer also has available a list of other
  401.     commercial translation products, and some for more obscure
  402.     languages.
  403.  
  404.     See also question 5.3.
  405.  
  406. 17.8:    Where can I get copies of all these public-domain programs?
  407.  
  408. A:    If you have access to Usenet, see the regular postings in the
  409.     comp.sources.unix and comp.sources.misc newsgroups, which
  410.     describe, in some detail, the archiving policies and how to
  411.     retrieve copies.  The usual approach is to use anonymous ftp
  412.     and/or uucp from a central, public-spirited site, such as uunet
  413.     (ftp.uu.net, 192.48.96.9).  However, this article cannot track
  414.     or list all of the available archive sites and how to access
  415.     them.  The comp.archives newsgroup contains numerous
  416.     announcements of anonymous ftp availability of various items.
  417.     The "archie" mailserver can tell you which anonymous ftp sites
  418.     have which packages; send the mail message "help" to
  419.     archie@quiche.cs.mcgill.ca for information.  Finally, the
  420.     newsgroup comp.sources.wanted is generally a more appropriate
  421.     place to post queries for source availability, but check _its_
  422.     FAQ list, "How to find sources," before posting there.
  423.  
  424. 17.9:    When will the next International Obfuscated C Code Contest
  425.     (IOCCC) be held?  How can I get a copy of the current and
  426.     previous winning entries?
  427.  
  428. A:    The contest typically runs from early March through mid-May.  To
  429.     obtain a current copy of the rules and other information, send
  430.     e-mail with the Subject: line "send rules" to:
  431.  
  432.         {apple,pyramid,sun,uunet}!hoptoad!obfuscate  or
  433.         obfuscate@toad.com
  434.  
  435.     Contest winners are first announced at the Summer Usenix
  436.     Conference in mid-June, and posted to the net in July.  Previous
  437.     winners are available on uunet (see question 17.8) under the
  438.     directory ~/pub/ioccc.
  439.  
  440. 17.10:    Why don't C comments nest?  Are they legal inside quoted
  441.     strings?
  442.  
  443. A:    Nested comments would cause more harm than good, mostly because
  444.     of the possibility of accidentally leaving comments unclosed by
  445.     including the characters "/*" within them.  For this reason, it
  446.     is usually better to "comment out" large sections of code, which
  447.     might contain comments, with #ifdef or #if 0 (but see question
  448.     5.7).
  449.  
  450.     The character sequences /* and */ are not special within
  451.     double-quoted strings, and do not therefore introduce comments,
  452.     because a program (particularly one which is generating C code
  453.     as output) might want to print them.
  454.  
  455.     References: ANSI Appendix E p. 198, Rationale Sec. 3.1.9 p. 33.
  456.  
  457. 17.11:    How can I implement sets and/or arrays of bits?
  458.  
  459. A:    Use arrays of char or int, with a few macros to access the right
  460.     bit at the right index (try using 8 for CHAR_BIT if you don't
  461.     have <limits.h>):
  462.  
  463.         #include <limits.h>        /* for CHAR_BIT */
  464.  
  465.         #define BITMASK(bit) (1 << ((bit) % CHAR_BIT))
  466.         #define BITSLOT(bit) ((bit) / CHAR_BIT)
  467.         #define BITSET(ary, bit) ((ary)[BITSLOT(bit)] |= BITMASK(bit))
  468.         #define BITTEST(ary, bit) ((ary)[BITSLOT(bit)] & BITMASK(bit))
  469.  
  470. 17.12:    What is the most efficient way to count the number of bits which
  471.     are set in a value?
  472.  
  473. A:    This and many other similar bit-twiddling problems can often be
  474.     sped up and streamlined using lookup tables (but see the next
  475.     question).
  476.  
  477. 17.13:    How can I make this code more efficient?
  478.  
  479. A:    Efficiency, though a favorite comp.lang.c topic, is not
  480.     important nearly as often as people tend to think it is.  Most
  481.     of the code in most programs is not time-critical.  When code is
  482.     not time-critical, it is far more important that it be written
  483.     clearly and portably than that it be written maximally
  484.     efficiently.  (Remember that computers are very, very fast, and
  485.     that even "inefficient" code can run without apparent delay.)
  486.  
  487.     It is notoriously difficult to predict what the "hot spots" in a
  488.     program will be.  When efficiency is a concern, it is important
  489.     to use profiling software to determine which parts of the
  490.     program deserve attention.  Often, actual computation time is
  491.     swamped by peripheral tasks such as I/O and memory allocation,
  492.     which can be sped up by using buffering and cacheing techniques.
  493.  
  494.     For the small fraction of code that is time-critical, it is
  495.     vital to pick a good algorithm; it is less important to
  496.     "microoptimize" the coding details.  Many of the "efficient
  497.     coding tricks" which are frequently suggested (e.g. substituting
  498.     shift operators for multiplication by powers of two) are
  499.     performed automatically by even simpleminded compilers.
  500.     Heavyhanded "optimization" attempts can make code so bulky that
  501.     performance is degraded.
  502.  
  503.     For more discussion of efficiency tradeoffs, as well as good
  504.     advice on how to increase efficiency when it is important, see
  505.     chapter 7 of Kernighan and Plauger's The Elements of Programming
  506.     Style, and Jon Bentley's Writing Efficient Programs.
  507.  
  508. 17.14:    Are pointers really faster than arrays?  How much do function
  509.     calls slow things down?  Is ++i faster than i = i + 1?
  510.  
  511. A:    Precise answers to these and many similar questions depend of
  512.     course on the processor and compiler in use.  If you simply must
  513.     know, you'll have to time test programs carefully.  (Often the
  514.     differences are so slight that hundreds of thousands of
  515.     iterations are required even to see them.  Check the compiler's
  516.     assembly language output, if available, to see if two purported
  517.     alternatives aren't compiled identically.)
  518.  
  519.     It is "usually" faster to march through large arrays with
  520.     pointers rather than array subscripts, but for some processors
  521.     the reverse is true.
  522.  
  523.     Function calls, though obviously incrementally slower than in-
  524.     line code, contribute so much to modularity and code clarity
  525.     that there is rarely good reason to avoid them.
  526.  
  527.     Before rearranging expressions such as i = i + 1, remember that
  528.     you are dealing with a C compiler, not a keystroke-programmable
  529.     calculator.  Any decent compiler will generate identical code
  530.     for ++i, i += 1, and i = i + 1.  The reasons for using ++i or
  531.     i += 1 over i = i + 1 have to do with style, not efficiency.
  532.     (See also question 4.4.)
  533.  
  534. 17.15:    This program crashes before it even runs!  (When single-stepping
  535.     with a debugger, it dies before the first statement in main.)
  536.  
  537. A:    You probably have one or more very large (kilobyte or more)
  538.     local arrays.  Many systems have fixed-size stacks, and those
  539.     which perform dynamic stack allocation automatically (e.g. Unix)
  540.     can be confused when the stack tries to grow by a huge chunk all
  541.     at once.
  542.  
  543.     It is often better to declare large arrays with static duration
  544.     (unless of course you need a fresh set with each recursive
  545.     call).
  546.  
  547.     (See also question 9.4.)
  548.  
  549. 17.16:    What do "Segmentation violation" and "Bus error" mean?
  550.  
  551. A:    These generally mean that your program tried to access memory it
  552.     shouldn't have, invariably as a result of improper pointer use,
  553.     often involving malloc.
  554.  
  555. 17.17:    Does anyone have a C compiler test suite I can use?
  556.  
  557. A:    Plum Hall (1 Spruce Ave., Cardiff, NJ 08232, USA), among others,
  558.     sells one.
  559.  
  560. 17.18:    Where can I get a YACC grammar for C?
  561.  
  562. A:    The definitive grammar is of course the one in the ANSI
  563.     standard.  Several copies are floating around; keep your eyes
  564.     open.  There is one on uunet (see question 17.8) in
  565.     usenet/net.sources/ansi.c.grammar.Z (including a companion
  566.     lexer).  The FSF's GNU C compiler contains a grammar, as does
  567.     the appendix to K&R II.
  568.  
  569.     References: ANSI Sec. A.2 .
  570.  
  571. 17.19:    How do you pronounce "char"?
  572.  
  573. A:    You can pronounce the C keyword "char" in at least three ways:
  574.     like the English words "char," "care," or "car;" the choice is
  575.     arbitrary.
  576.  
  577. 17.20:    What's a good book for learning C?
  578.  
  579. A:    Mitch Wright maintains an annotated bibliography of C and Unix
  580.     books; it is available for anonymous ftp from ftp.rahul.net in
  581.     directory pub/mitch/YABL.
  582.  
  583.     This FAQ list's editor maintains a collection of previous
  584.     answers to this question, which is available upon request.
  585.  
  586. 17.21:    Where can I get extra copies of this list?  What about back
  587.     issues?
  588.  
  589. A:    For now, just pull it off the net; it is normally posted to
  590.     comp.lang.c on the first of each month, with an Expiration: line
  591.     which should keep it around all month.  It can also be found in
  592.     the newsgroup news.answers .  Several sites archive news.answers
  593.     postings and other FAQ lists, including this one; the archie
  594.     server (see question 17.8) should help you find them.  See the
  595.     meta-FAQ list in news.answers for more information.
  596.  
  597.     This list is an evolving document, not just a collection of this
  598.     month's interesting questions.  Older copies are obsolete and
  599.     don't contain much, except the occasional typo, that the current
  600.     list doesn't.
  601.  
  602.  
  603. Bibliography
  604.  
  605. ANSI    American National Standard for Information Systems --
  606.     Programming Language -- C, ANSI X3.159-1989 (see question 5.2).
  607.  
  608. JLB    Jon Louis Bentley, Writing Efficient Programs, Prentice-Hall,
  609.     1982, ISBN 0-13-970244-X.
  610.  
  611. H&S    Samuel P. Harbison and Guy L. Steele, C: A Reference Manual,
  612.     Second Edition, Prentice-Hall, 1987, ISBN 0-13-109802-0.
  613.     (A third edition has recently been released.)
  614.  
  615. PCS    Mark R. Horton, Portable C Software, Prentice Hall, 1990,
  616.     ISBN 0-13-868050-7.
  617.  
  618. EoPS    Brian W. Kernighan and P.J. Plauger, The Elements of Programming
  619.     Style, Second Edition, McGraw-Hill, 1978, ISBN 0-07-034207-5.
  620.  
  621. K&R I    Brian W. Kernighan and Dennis M. Ritchie, The C Programming
  622.     Language, Prentice Hall, 1978, ISBN 0-13-110163-3.
  623.  
  624. K&R II    Brian W. Kernighan and Dennis M. Ritchie, The C Programming
  625.     Language, Second Edition, Prentice Hall, 1988, ISBN 0-13-
  626.     110362-8, 0-13-110370-9.
  627.  
  628. Knuth    Donald E. Knuth, The Art of Computer Programming, (3 vols.),
  629.     Addison Wesley, 1981.
  630.  
  631. CT&P    Andrew Koenig, C Traps and Pitfalls, Addison-Wesley, 1989,
  632.     ISBN 0-201-17928-8.
  633.  
  634.     P.J. Plauger, The Standard C Library, Prentice Hall, 1992,
  635.     ISBN 0-13-131509-9.
  636.  
  637.     Harry Rabinowitz and Chaim Schaap, Portable C, Prentice-Hall,
  638.     1990, ISBN 0-13-685967-4.
  639.  
  640. There is a more extensive bibliography in the revised Indian Hill style
  641. guide (see question 14.3).  See also question 17.20.
  642.  
  643.  
  644. Acknowledgements
  645.  
  646. Thanks to Jamshid Afshar, Sudheer Apte, Dan Bernstein, Stan Brown, Joe
  647. Buehler, Burkhard Burow, D'Arcy J.M. Cain, Raymond Chen, Christopher
  648. Calabrese, James Davies, Norm Diamond, Ray Dunn, Stephen M. Dunn, Bjorn
  649. Engsig, Dave Gillespie, Samuel Goldstein, Alasdair Grant, Ron Guilmette,
  650. Doug Gwyn, Tony Hansen, Joe Harrington, Guy Harris, Jos Horsmeier, Blair
  651. Houghton, Kirk Johnson, Peter Klausler, Andrew Koenig, Tom Koenig, John
  652. Lauro, Don Libes, Christopher Lott, Tim McDaniel, Evan Manning, Barry
  653. Margolin, Mark Moraes, Darren Morby, Richard A. O'Keefe, Hans Olsson,
  654. Francois Pinard, randall@virginia, Pat Rankin, Rich Salz, Chip
  655. Salzenberg, Paul Sand, Doug Schmidt, Patricia Shanahan, Peter da Silva,
  656. Joshua Simons, Henry Spencer, Erik Talvola, Clarke Thatcher, Chris
  657. Torek, Goran Uddeborg, Wietse Venema, Ed Vielmetti, Larry Virden, Freek
  658. Wiedijk, and Dave Wolverton, who have contributed, directly or
  659. indirectly, to this article.  Special thanks to Karl Heuer, and
  660. particularly to Mark Brader, who (to borrow a line from Steve Johnson)
  661. have goaded me beyond my inclination, and occasionally beyond my
  662. endurance, in relentless pursuit of a better FAQ list.
  663.  
  664.  
  665.                     Steve Summit
  666.                     scs@adam.mit.edu
  667.                     scs%adam.mit.edu@mit.edu
  668.                     mit-eddie!adam.mit.edu!scs
  669.  
  670. This article is Copyright 1988, 1990-1992 by Steve Summit.
  671. It may be freely redistributed so long as the author's name, and this
  672. notice, are retained.
  673. The C code in this article (vstrcat(), error(), etc.) is public domain
  674. and may be used without restriction.
  675. Xref: bloom-picayune.mit.edu rec.arts.disney:11446 news.answers:4726
  676. Path: bloom-picayune.mit.edu!enterpoop.mit.edu!mojo.eng.umd.edu!darwin.sura.net!mlb.semi.harris.com!uflorida!purdue!haven.umd.edu!uunet!seismo!tanida
  677. From: tanida@forseti.css.gov (Tom Tanida)
  678. Newsgroups: rec.arts.disney,news.answers
  679. Subject: rec.arts.disney FAQ, part 1a
  680. Summary: FAQ for rec.arts.disney
  681. Keywords: FAQ, disney
  682. Message-ID: <51656@seismo.CSS.GOV>
  683. Date: 16 Dec 92 22:44:36 GMT
  684. Expires: 16 Dec 92 22:44:36 GMT
  685. Sender: usenet@seismo.CSS.GOV
  686. Reply-To: tanida@esosun.css.gov (Tom Tanida)
  687. Followup-To: rec.arts.disney
  688. Lines: 645
  689. Approved: news-answers-request@MIT.Edu
  690. Nntp-Posting-Host: beno.css.gov
  691. Originator: tanida@beno.CSS.GOV
  692.  
  693. Archive-name: disney-faq/part1a
  694. Last-modified: 16 Dec 1992
  695.  
  696. Frequently Asked Questions List For rec.arts.disney, part 1
  697. Version 1.4, last revised 12/16/92
  698.